package com.cy.pj.category.service;

import com.cy.pj.category.dao.CategoryDao;
import com.cy.pj.category.pojo.Category;
import com.cy.pj.common.anno.RequiredCache;
import com.cy.pj.common.anno.TestFindMethod;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class CategoryServiceImpl implements CategoryService{

    @Autowired
    private CategoryDao categoryDao;


    @Override
    @TestFindMethod
    @RequiredCache
    public List<Category> findCategory(String name) {
        return categoryDao.findCategory(null) ;
    }

    @Override
    public Category findCategoryById(String id) {
        return categoryDao.findCategoryById(id);
    }

    @Override
    public Integer updateCategory(Category category) {
        return categoryDao.updateCategory(category);
    }

    @Override
    public Integer insertCategory(Category category) {
        return categoryDao.insertCategory(category);
    }

    @Override
    public Integer deleteCategoryById(String id) {
        return categoryDao.deleteCategoryById(id);
    }
}
